// 云函数入口文件
const createRemind = require('./lib/createRemind')
const queryRemind = require('./lib/queryRemind')

// 云函数入口函数
exports.main = async (event, context) => {
  try {
    switch (event.action) {
      case 'getData': {
        return queryRemind(event.id)
      }
      case 'createData': {
        const {
          action,
          ...data
        } = event
        return createRemind(data)
      }
    }
  } catch (e) {
    return {
      err: e
    }
  }
}